package com.gxuwz.business.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;


import com.gxuwz.business.dao.impl.BaseDaoImpl;
import com.gxuwz.business.entity.SysUserRole;

@Repository("sysUserRoleDAO")
public class SysUserRoleDAO extends BaseDaoImpl<SysUserRole>{
	
	/**
	 * 通过用户编号查找
	 * @param userId
	 * @return
	 */

	@SuppressWarnings("unchecked")
	public List<SysUserRole> findById(String userId) {
		// TODO Auto-generated method stub
		String hql = "from SysUserRole where userId = '"+userId+"'";
		return (List<SysUserRole>)this.getHibernateTemplate().find(hql);
	}

	public void delteById(String userId) {
		// TODO Auto-generated method stub
		String hql = "delete from SysUserRole where userId='"+userId+"'";
		this.getHibernateTemplate().bulkUpdate(hql);
		
	}

	public List<SysUserRole> findByRoleId(String roleId) {
		String hql = "from SysUserRole where roleId='"+roleId+"'";
		return (List<SysUserRole>) getHibernateTemplate().find(hql);
	}

	

}
